/**
 * Author: Daniel Michalski
 * Date: 28.03.13
 */

public class BufferedReaderDemo {
    public static void main(String[] args) {
        /*String s = "&copy; jest symbolem praw autorskich, " +
                   "natomiast &copy takim symbolem nie jest.\n";

        char[] buff = new char[s.length()];
        s.getChars(0, s.length(), buff, 0);

        CharArrayReader in = new CharArrayReader(buff);
        int c;
        boolean marked = false;

        try ( BufferedReader f = new BufferedReader(in)) {
            while ((c = f.read()) != -1) {
                switch (c) {
                    case '&' :
                        if (!marked) {
                            f.mark(32);
                            marked = true;
                        } else {
                            marked = false;
                        }
                        break;
                    case ';' :
                        if (marked) {
                            marked = false;
                            System.out.println("(c)");
                        } else
                            System.out.println((char) c);
                        break;
                    case ' ' :
                        if (marked) {
                            marked = false;
                            f.reset();
                            System.out.println("&");
                        } else
                            System.out.println((char) c);
                        break;
                    default :
                        if (!marked)
                            System.out.println((char) c);
                        break;
                }
            }

        } catch (IOException ex) {
            System.out.println("Błąd wejścia-wyjscia: " + ex);
        }
*/
    }

}
